package com.example.travelservlet.utils;

import com.example.travelservlet.user.domain.Result;

/**
 * @author dell
 */
public class ResultUtil {

    public static<T> Result sucess(String code,String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static<T> Result success(T data){
        Result result = sucess("200","成功",data);
        return result;
    }

    public static<T> Result error(String code,String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static<T> Result error(T data){
        Result result = error("500","失败",data);
        return result;
    }

}
